#ifndef STUDENTSQL_H
#define STUDENTSQL_H

#include <QObject>
#include <QSqlDatabase>

struct StudentInfo
{
    QString s_id;
    QString s_name;
    quint8 s_age;
    QString s_sex;
    QString s_class;
    QString s_dept;
    QString s_addr;
};

class StudentSql : public QObject
{
    Q_OBJECT
public:
    static StudentSql *ptrstudSql;
    static StudentSql *getinstance()
    {
        if(nullptr == ptrstudSql)
        {
            ptrstudSql = new StudentSql;
        }
        return ptrstudSql;
    }
    explicit StudentSql(QObject *parent = nullptr);

    void init();

    QList<StudentInfo> getResult(QString sql);

signals:
private:
    QSqlDatabase m_db;
};

#endif // STUDENTSQL_H
